<template>
  <div id="app">
    <visual-editor
      v-model="jsonData"
      :config="visualConfig"
      :formData="formData"
      :customProps="customProps"
    ></visual-editor>
    <div>{{ JSON.stringify(formData) }}</div>
  </div >
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { VisualEditor } from './packages/visual-editor';
import {visualConfig} from '@/visual-config'
import jsonData from './data.json'

export default defineComponent({
  name: 'App',
  components: {
    VisualEditor
  },
  data () {
    return {
      visualConfig,
      jsonData,
      formData: {
        username: 'admin',
        minLevel: 10,
        maxLevel: 20,
        shopType: ''
      },
      customProps: {
        subBtn: {
          onClick: () => {
            this.$notify({ message: '执行表单数据校验以及提交到服务器的动作' })
          },
        },
        mySelect: {
          onChange: () => {
            this.$notify({
              message: '选择了新的食物',
            })
          },
        },
      }
    }
  }
});
</script>

<style lang="scss">
#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
</style>
